home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 7
/
Apprentice-Release7.iso
/
Environments
/
MacMETH 3.2.4
/
MacMETH Docu
/
LineDrawing.DEF
< prev
next >
Wrap
Text File
|
1996-06-20
|
6KB
|
111 lines
DEFINITION MODULE LineDrawing;
(*******************************************************************)
(* *)
(* Module LineDrawing (system library module, Version 3.0) *)
(* *)
(* Purpose Simple driver for graphics output. *)
(* This module is derived from module LineDrawing *)
(* by Prof. Dr. N. Wirth, Institut fuer Informatik *)
(* ETHZ, ETH-Zentrum, CH-8092 Zuerich, SWITZERLAND, *)
(* designed for the Lilith computer (Version: *)
(* NW 15.1.82 (Lilith handbook)). *)
(* *)
(* This module provides a single drawing plane, *)
(* using up almost the whole output screen. It *)
(* contains a two-dimensional coordinate system with *)
(* its origin in the lower left corner of the plane. *)
(* *)
(* Remark The current implementation is for an *)
(* Apple Macintosh. It contains a Macintosh *)
(* specific update mechanism (procedure Replay) *)
(* and has been extended by procedure mapArea *)
(* programmed by A.Itten. *)
(* *)
(* Programming: Alex Itten & *)
(* Andreas Fischlin *)
(* Institut Automatik und *)
(* Industrielle Elektronik *)
(* ETHZ,ETH-Zentrum, CH-8092 Zurich *)
(* SWITZERLAND *)
(* September 1985 *)
(* *)
(* last modified: 30 March 1986 *)
(* *)
(*******************************************************************)
TYPE
PaintMode = (replace, paint, invert, erase);
VAR
Px, Py : INTEGER; (*current coordinates of pen,read-only*)
(*(0,0) = lower, left corner*)
mode : PaintMode; (*current mode for paint and copy and line
resp. lineto. read-only*)
width : INTEGER; (*width of picture area, read-only*)
height : INTEGER; (*height of picture are, read-only*)
CharWidth : INTEGER; (*width of a character, read-only*)
CharHeight: INTEGER; (*height of a character, read-only*)
PROCEDURE SetMode(mode:PaintMode);
(*set one of the four modes for dot,area,line,lineto and copyArea*)
PROCEDURE moveto(x,y : INTEGER);
(*moves the pen without any drawing*)
PROCEDURE dot(c: CARDINAL; x,y: INTEGER);
(*place dot in color c at coordinate (x,y). 0 = white, 1,2,3 = black
does affect the penlocation, but doesn't change the colour
(penpattern). Dot is allways of the dimension 1 by 1*)
PROCEDURE line(d,n: CARDINAL);
(*draw a line by moving pen by n pixels from current position
in direction d (angle = 45*d degrees). Uses the current pen mode.*)
PROCEDURE lineto(x,y: INTEGER);
(*draw a line by moving pen from current position to new
position (x,y). Uses the current pen mode*)
PROCEDURE SetClipRect(x,y,w,h: INTEGER);
(*low level clip mechanism. Any Drawing outside this rectangle
will be suppressed. x,y: lower left Point; w: width; h: height*)
PROCEDURE area(c: CARDINAL; x,y,w,h: INTEGER);
(*paint the rectangular area at x,y of width w and height h in
color c. 0 = white, 1 = light grey, 2 = dark grey, 3 = black*)
PROCEDURE copyArea(sx,sy,dx,dy,dw,dh: INTEGER);
(*copy rectangular area at sc,sy into rectangle at dx,dy of width
dw and height dh*)
PROCEDURE mapArea(sx,sy,sw,sh,dx,dy,dw,dh : INTEGER);
(*maps a source area given by lower left point ( sx,sy) the width (sw)
and the height (sh) into a destination area given by sx,sy,sw,sh.
in addition to copyArea you may change the size of your copy. *)
PROCEDURE clear;
(*clears the screen and draws a gray outline around the lineDrawing
plane. It changes also the clipRect to the whole plane and moves
the cursor to the center of the LineDrawing plane. The copy of
the screen is cleared too.*)
PROCEDURE Write(ch: CHAR);
(*write ch at pen's position; update (Px,Py) to point to the right
of ch, ready for next character. Because the colours in the PROCEDURE
area are implemented as patterns, Write and WriteString clears the needed
area before writing. *)
PROCEDURE WriteString(s: ARRAY OF CHAR);
(*write s at pen's position; update (Px,Py) to point to the right
of s, ready for next string or character. Because the colours in the
PROCEDURE area are implemented as patterns, Write and WriteString
clears the needed area before writing.*)
PROCEDURE Replay;
(*calling this procedure in response to an update event, it
restores the whole lineDrawing plane *)
END LineDrawing.